package leetcode.code0088;

public class Solution extends Solution88 {

	@Override
	public void merge(int[] nums1, int m, int[] nums2, int n) {
		int p1 = m - 1;
		int p2 = n - 1;
		int avl = nums1.length - 1;
		while (p1 >= 0 && p2 >= 0) {
			if (nums2[p2] > nums1[p1]) {
				nums1[avl--] = nums2[p2--];
			} else {
				nums1[avl--] = nums1[p1--];
			}
		}
		while (p1 >= 0) {
			nums1[avl--] = nums1[p1--];
		}
		while (p2 >= 0) {
			nums1[avl--] = nums2[p2--];
		}
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();
		so.debug5();
	}

}
